﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
using ForumsBrowser.BusinessObjects;

namespace ForumsBrowser
{
    public class MessageColorConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && !(value is string)) throw new NotSupportedException("Wrong Type");
            var msg = value as string;
            if (msg != null)
            {
                switch (msg)
                {
                    case "answer": return Colors.DarkGreen;
                    case "propose": return Colors.DarkBlue;
                    
                    default: return Colors.DarkGray;
                }
            }
            return Colors.DarkGray;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
